package com.xiaoyu.lanling.event.gift

import `in`.srain.cube.request.JsonData
import com.xiaoyu.base.event.BaseJsonEvent
import com.xiaoyu.im.ChatToken
import com.xiaoyu.lanling.feature.gift.model.Gift
import com.xiaoyu.lanling.feature.im.request.MessageRequestBuilder

class GiveGiftAndSendMessageEvent(requestTag: Any, jsonData: JsonData) : BaseJsonEvent(requestTag, jsonData) {
    val gift = Gift(0, jsonData)
    val from = jsonData.optString("from")

    init {
        MessageRequestBuilder.newBuilder(ChatToken.forUid(gift.toUid), from)
                .gift(jsonData)
                .buildAndSend()
    }
}